/**
 * 
 */
package org.paybiz.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description:
 * @author Nassir.wen
 * @date 2010-10-13 上午10:07:18
 */
public class PayConstant {

    public static final String PAY_BIZ_KEY = "";
    
    /** 成功 */
    public static final int RESULT_SUCCESS = 0;

    /** 失败 */
    public static final int RESULT_FAIL = 1;
    /** 未支付 */
    public static final int NOT_PAY = 1;
    /**
     * 自动对账异常
     */
    public static final int AUTO_CHECK_ORDER_ERROR = 2;

    /** 编码格式GBK */
    public static final String CHARSET_GBK = "GBK";

    /** 编码格式UTF-8 */
    public static final String CHARSET_UTF_8 = "UTF-8";

    /** 支付中心地址 */
    public static final String PAYCENTER_URL = "pay_biz_url";
    
    /**易宝支付  */
    public static final String YEEPAY = "yeepay";

    /**支付宝支付*/
    public static final String ALIPAY = "alipay";

    /**财付通支付*/
    public static final String TENPAY = "tenpay";

    /**快钱支付*/
    public static final String BILL99 = "bill99";

    /**语音支付*/
    public static final String IVRPAY = "ivrpay";

    /**银联支付*/
    public static final String UNIONPAY = "unionpay";

    public static enum PayType {
        YEEPAY(PayConstant.YEEPAY, "易宝"), ALIPAY(PayConstant.ALIPAY, "支付宝"), TENPAY(PayConstant.TENPAY, "财付通"), BILL99(
                PayConstant.BILL99, "快钱"), UNIONPAY(PayConstant.UNIONPAY, "银联");

        private final String key;
        private final String value;

        private PayType(String k, String v) {
            this.key = k;
            this.value = v;
        }

        public String key() {
            return this.key;
        }

        public String value() {
            return this.value;
        }
    }

    //私有的防止外部修改,对应get获取值
    private static Map<String, String> payTypeMap = new HashMap<String, String>() {
        private static final long serialVersionUID = 1L;
        {
            for (PayType r : PayType.values()) {
                put(r.key, r.value);
            }
        }
    };

    public static String getPayTypeValue(String key) {
        return payTypeMap.get(key);
    }

    public static void main(String[] args) {
        System.out.println(PayConstant.getPayTypeValue(PayConstant.BILL99));
    }
}
